package com.le.test;

import org.junit.Test;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

/**
 * 打印一个字符串的全部子序列，包括空字符串
 */
public class Code_08_StringAllSubSeq {

    public static void getAllSeq(String str) {
        if (str == null || str.length() == 0) {
            return;
        }
        process(str.toCharArray(), 0, "");
    }

    public static void process(char[] chs, int i, String res) {
        if (i == chs.length) {
            System.out.println(res);
            return;
        }
        process(chs, i + 1, res);
        process(chs, i + 1, chs[i] + res);
    }

    @Test
    public void test() {
        String s = "abc";
        getAllSeq(s);
        LinkedList<Integer> queue= new LinkedList<>();
        Stack<Integer> stack = new Stack<>();
    }
}
